package com.bee.plus.ai.baidu;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Data
public class BaiduAiManager {

    @Value("${ai.baidu.apiKey}")
    public  String apiKey;

    @Value("${ai.baidu.apiSecret}")
    public  String secretKey;


    private static String tokeUrl="https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=%s&client_secret=%s";




    public String getTokenUrl(){
        return String.format(tokeUrl,apiKey,secretKey);
    }

    public String getChatUrl(String token){
        return "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token="+token;
    }

    public String getChatUrlSpeed(String token){
        return "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_speed?access_token="+token;
    }

}
